﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace AirLinq.Providers.Sql {
	public class SqlQueryExpression : SqlQueryExpressionBase {
		private readonly SqlQueryExpressionBase _top;
		private readonly SqlQueryExpressionBase _bottom;
		private readonly SqlNodeType _nodeType;
		public SqlQueryExpression(SqlNodeType nodeType, SqlQueryExpressionBase top, SqlQueryExpressionBase bottom) {
			if (top == null) {
				throw new ArgumentNullException("top");
			}
			if (bottom == null) {
				throw new ArgumentNullException("bottom");
			}
			if (nodeType!=SqlNodeType.Union
				&& nodeType != SqlNodeType.UnionAll
				&& nodeType != SqlNodeType.Except
				&& nodeType != SqlNodeType.Intersect) {
				throw new ArgumentException("unsupported nodeType");
			}
			_top = top;
			_bottom = bottom;
			_nodeType = nodeType;
		}
		public SqlQueryExpressionBase Top {
			get {
				return _top;
			}
		}
		public SqlQueryExpressionBase Bottom {
			get {
				return _bottom;
			}
		}
		public override SqlNodeType NodeType {
			get {
				return _nodeType;
			}
		}
	}
}
